package com.kitty.game.xmd;


import com.kitty.game.child.model.ChildInfo;
import com.kitty.game.role.model.Role;
import com.kitty.mina.annotation.RequestMapping;
import com.kitty.mina.cache.SessionUtils;
import com.kitty.mina.message.MessagePusher;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class SetRecommendXmdController {
    Logger logger = LoggerFactory.getLogger(SetRecommendXmdController.class);

    @RequestMapping
    public void set_recommend_xmd(IoSession session,SetRecommendXmdInfo setRecommendXmdInfo) {
        Role role = SessionUtils.getRoleBySession(session);
        ChildInfo info = role.getChildInfo();
        info.setUpgradeAddType(setRecommendXmdInfo.getAddType());
        info.setUpgradeIsOpen(setRecommendXmdInfo.getIsOpen());
        RecommendXmdInfo recommendXmdInfo = new RecommendXmdInfo();
        recommendXmdInfo.setAddType(info.getUpgradeAddType());
        recommendXmdInfo.setIsOpen(info.getUpgradeIsOpen());
        MessagePusher.pushMessage(role, recommendXmdInfo);
    }
}
